package org.aphelie.romancer.model.editor.character.presentation;

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;

public class CharacterModelWizard extends Wizard implements INewWizard {
	
	private IWorkbench workbench;
	private IStructuredSelection selection;
	
	protected CharacterModelWizardNewFileCreationPage newFileCreationPage;

	@Override
	public void init(IWorkbench workbench, IStructuredSelection selection) {
		this.workbench = workbench;
		this.selection = selection;
		setWindowTitle(getClass().getName() + " TITLE");
	}
	
	@Override
	public void addPages() {
		newFileCreationPage = new CharacterModelWizardNewFileCreationPage(getClass().getName() + " PAGE", selection);
		newFileCreationPage.setTitle(getClass().getName() + " TITLE");
		newFileCreationPage.setDescription(getClass().getName() + " DESCRIPTION");
		newFileCreationPage.setFileName("default.tgk");
		addPage(newFileCreationPage);
		
		
	}
	
	/*
	 * 
	 * 	

		// Try and get the resource selection to determine a current directory for the file dialog.
		//
		if (selection != null && !selection.isEmpty()) {
			// Get the resource...
			//
			Object selectedElement = selection.iterator().next();
			if (selectedElement instanceof IResource) {
				// Get the resource parent, if its a file.
				//
				IResource selectedResource = (IResource)selectedElement;
				if (selectedResource.getType() == IResource.FILE) {
					selectedResource = selectedResource.getParent();
				}

				// This gives us a directory...
				//
				if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
					// Set this for the container.
					//
					newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());

					// Make up a unique new name here.
					//
					String defaultModelBaseFilename = ChronicleEditorPlugin.INSTANCE.getString("_UI_ChronicleEditorFilenameDefaultBase");
					String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
					String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
					for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
						modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
					}
					newFileCreationPage.setFileName(modelFilename);
				}
			}
		}
		initialObjectCreationPage = new ChronicleModelWizardInitialObjectCreationPage("Whatever2");
		initialObjectCreationPage.setTitle(ChronicleEditorPlugin.INSTANCE.getString("_UI_ChronicleModelWizard_label"));
		initialObjectCreationPage.setDescription(ChronicleEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
		addPage(initialObjectCreationPage);
	}
	 */
	
	
	

	@Override
	public boolean performFinish() {
		// TODO Auto-generated method stub
		return false;
	}

}
